<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pretty="http://ocpsoft.com/prettyfaces"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="../templates/mainTemplate.xhtml">

	<ui:define name="ajaxStatus">
	</ui:define>

	<ui:define name="content">
		<div class="box">
			<h2>
				<a id="toggle-current-quotations" href="#"><h:outputText
						value="#{msg['activeorders.active']}" /></a>
			</h2>
			<div id="current-quotations" class="block tables">
				<p:ajaxStatus style="width:16px;height:16px;">
					<f:facet name="start">
						<p:graphicImage value="#{resource['img:ajaxloading.gif']}" />
					</f:facet>

					<f:facet name="complete">
						<h:outputText value="" />
					</f:facet>
				</p:ajaxStatus>

				<h:form prependId="false">
					<p:messages showDetail="true" showSummary="false" autoUpdate="true" />

					<p:dataTable id="dataTable" var="order" widgetVar="orderTable"
						value="#{activeOrdersListBean.orders}" paginator="true" rows="30"
						paginatorPosition="top"
						emptyMessage="#{msg['prime.noRecordsFound']}">
						<f:facet name="header">
							<p:outputPanel>
								<h:outputText value="#{msg['activeorders.search']}" />
								<p:inputText id="globalFilter" onkeyup="orderTable.filter()" />
							</p:outputPanel>
						</f:facet>
						<p:columnGroup type="header">

							<p:row>
								<p:column rowspan="2"
									headerText="#{msg['activeorders.company']}"
									sortBy="#{order.company.name}" filterBy="#{order.company.name}"
									filterMatchMode="startsWith" filterStyle="display: none;" />
								<p:column rowspan="2" headerText="#{msg['activeorders.order']}"
									sortBy="#{order.transactionType}" />
								<p:column rowspan="2" headerText="#{msg['activeorders.amount']}" />
								<p:column rowspan="2"
									headerText="#{msg['activeorders.priceLimit']}" />
								<p:column rowspan="2" headerText="#{msg['activeorders.type']}"
									sortBy="#{order.priceType}" />
								<p:column colspan="2" headerText="#{msg['activeorders.expire']}" />
								<p:column rowspan="2" headerText="#{msg['activeorders.cancel']}" />
							</p:row>

							<p:row>
								<p:column headerText="#{msg['activeorders.expiryDate']}"
									sortBy="#{order.expiryDate}" />
								<p:column headerText="#{msg['activeorders.orderDate']}"
									sortBy="#{order.submissionDate}" />
							</p:row>
						</p:columnGroup>

						<p:column>
							<pretty:link mappingId="companyDetails">
								<f:param value="#{order.company.name}" />
								<h:outputText value="#{order.company.name}" />
							</pretty:link>
						</p:column>

						<p:column>
							<h:outputText style="font-weight: bold; color: #669900;"
								value="#{order.formattedTransactionType}" />
						</p:column>

						<p:column>
							<h:outputText value="#{order.amount}" />
						</p:column>

						<p:column>
							<h:outputText style="font-weight: bold; color: #FF0000;"
								value="#{order.formattedPriceLimit}" />
						</p:column>

						<p:column>
							<h:outputText value="#{order.formattedPriceType}" />
						</p:column>

						<p:column>
							<h:outputText style="font-weight: bold;"
								value="#{order.formattedExpiryDate}" />
						</p:column>

						<p:column>
							<h:outputText value="#{order.formattedSubmissionDate}" />
						</p:column>

						<p:column>
							<p:commandButton id="button"
								binding="#{activeOrdersListBean.button}" process="@none"
								update="@form"
								actionListener="#{activeOrdersListBean.cancelOrder(order)}"
								image="ui-icon-close">
							</p:commandButton>
						</p:column>

					</p:dataTable>
				</h:form>
			</div>
		</div>
	</ui:define>
</ui:composition>

</html>
